﻿package singleton_pattern;

/**
 * @author cbf4Life cbf4life@126.com
 * I'm glad to share my knowledge with you all.
 */

/**
 * 延时加载
 */
public final class Singleton1 {
	private static Singleton1 singleton = null;
	
	//限制产生多个对象
	private Singleton1(){
		
	}
	
	//通过该方法获得实例对象
	public synchronized static Singleton1 getSingleton(){
		if(singleton == null){
			singleton = new Singleton1();
		}
		return singleton;		
	}
}
